import { SAVE_USER, SAVE_PROFILE } from '../contants/profile'

const initialState = {
  user: {},
  userProfile: {},
}

export const profile = (state = initialState, action) => {
  const { type, payload } = action
  switch (type) {
    case SAVE_USER:
      return { ...state, user: { ...payload } }

    case SAVE_PROFILE:
      return { ...state, userProfile: payload }
    default:
      return state
  }
}
